<template>
  <el-dialog
    title="选择货品"
    width="80%"
    :close-on-click-modal="false"
    :before-close="close"
    :visible.sync="productSelectVisible"
    :append-to-body="true">
    <product :isNoSelect="false" :grandDataForm="childDataForm" @clickBtn="clickBtn" @clickRow="clickRow"></product>
  </el-dialog>
</template>

<script>
import Product from './product-2class'
export default {
  name: 'product-select',
  data () {
    return {
      productSelectVisible: false
    }
  },
  props:["childDataForm"],
  created() {
		this.productSelectVisible = true
	},
  components: {
    Product
  },
  methods: {
  	close() {
  		this.productSelectVisible = false
  		this.$emit('showProductSelect')
  	},
    clickRow (row) {
      if (!this.childDataForm.isMultiple) {
        this.close()
        this.$emit('getProduct',row)
      }
    },
    clickBtn (products) {
      if (this.childDataForm.isMultiple) {
        this.close()
        this.$emit('getProduct',products)
      }
    }
  }
}
</script>

<style scoped>

</style>
